package com.xyhuo.leetcode.december;

import java.util.List;
import java.util.Objects;

/**
 * 判别首字母缩略词
 * https://leetcode.cn/problems/check-if-a-string-is-an-acronym-of-words/
 *
 * @time 2023/12/20
 */
public class IsAcronym {

    public boolean isAcronym(List<String> words, String s) {
        if (words.size() != s.length()) {
            return false;
        }
        for (int i = 0; i < words.size(); i++) {
            String wordFirst = words.get(i).substring(0, 1);
            String tmp = s.substring(i, i + 1);
            if (!Objects.equals(wordFirst, tmp)) {
                return false;
            }
        }
        return true;
    }
}
